The present invention relates to a method of switching, before decoding, from a first coded video sequence at a bitrate Rold to a second one at a higher bitrate Rnew, and to a corresponding device for implementing said method.
As described for instance in the document xe2x80x9cMPEG video coding: a basic tutorial introductionxe2x80x9d, BBC report RD 1996/3, an MPEG-type compressed video sequence is subdivided into groups of pictures (or GOPs) that are themselves including different types of coded pictures (an example of GOP is described in FIG. 1):
intra-coded pictures (I-pictures), that are coded without any reference to other pictures;
predictive-coded pictures (P-pictures), that are coded using prediction from past reference;
bidirectionally predictive-coded pictures (B-pictures), that are coded using prediction from past and/or future reference(s).
According to the different types of prediction, pictures are coded with more or less efficiency, and the resulting number of bits is not constant. Moreover, as a picture is supposed, according to the MPEG specifications, to be instantaneously decoded every frame period Tv, the first bit of the coded pictures does not spend the same time in the decoder""s buffer: this variable time, defined in the MPEG syntax, is called the vbv_delay (vbv=video buffering verifier). An example of decoder""s buffer fullness for a stream coded at a constant bitrate and where a picture is instantaneously decoded every frame period Tv is shown in FIG. 2 (decoder""s buffer fullness versus time) for successive pictures I0 to I4 with respective vbv_delays vbv(I0), vbv(I1), . . . , vbv(I4), . . . , etc. The bitrate for a picture is given by the slope, and the fullness (or decoder""s buffer state) is given by the highest point for each period Tv. According to FIG. 3, the size d(Ij) of a picture Ij decoded at time td(Ij) is equal to:
d(Ij)=Sxe2x88x92(Ij)xe2x88x92S+(Ij)xe2x80x83xe2x80x83(1)
with Sxe2x88x92(Ij) and S+(Ij) designating respectively the decoder""s buffer state at time tdxe2x88x92(Ij)1(=the time just before the picture Ij is removed from decoder""s buffer) and at time td+(Ij)2(=the time just after the picture Ij is removed from decoder""s buffer). For this picture Ij, the relation between its vbv_delay vbv(Ij), the bitrate R of the video stream and the decoder""s buffer state Sxe2x88x92(Ij) is given by:
Sxe2x88x92(Ij)=vbv(Ij).Rxe2x80x83xe2x80x83(2)
One has also:
S+(Ij)=Sxe2x88x92(Ij+1)xe2x88x92R.Tvxe2x80x83xe2x80x83(3)
From relations (2), (1), (3), it can be deduced a more precise relation giving the size d(Ij) of the decoded picture Ij:
d(Ij)=R.(vbv(Ij)xe2x88x92vbv(Ij+1)+Tv)xe2x80x83xe2x80x83(4)
Due to this regulation model, a simple switch between two compressed (coded) video sequences is not always possible. Generally, the bitrates Rold and Rnew of the old and new video sequences are indeed different. So, when a switching point is crossing the decoder""s buffer, the input rate entering said buffer is different from the one that would have entered in absence of switching. As explained in relation with FIGS. 4 and 5, a problem of buffer may then occur during the transition period when pictures of the old sequence are decoded and in the same time pictures of the new sequence enter the decoder""s buffer: there is a risk of overflow when the input rate becomes greater than the previous one.
FIG. 4 shows indeed simultaneously some pictures of the old video sequence (the last transmitted pictures 01, 02 and the first replaced picture 03 of said sequence) and the two first transmitted pictures N1, N2 of the new one. Each picture being, as already said, decoded every period Tv, the vbv_delay vbv(N1) of the first transmitted picture N1 of the new sequence gives the time tsw of the switching (in FIG. 4, said vbv_delay is at most equal to the vbv_delay vbv(03) of the first replaced picture 03: the switching is not at all possible if it is not the case, since these vbv_delays vbv(N1) and vbv(03) would not be compatible). As then illustrated in FIG. 5 that shows the resulting stream in the decoder""s buffer, the first bits of N1 are entering said buffer when the bits of 02 are still entering this buffer and before 02 is decoded. As the bitrate Rnew is greater than the old one Rold, this situation leads, in FIG. 5, to an overflow, Smax designating the maximum size of the decoder""s buffer state as defined by the relation (2) (it may be noted here that a problem of underflow is not possible since there are always bits of a picture of the old sequence or of the new one in the decoder""s buffer).
An object of the invention is therefore to propose an original method to avoid buffer overflow.
To this end the invention relates to a method such as described in the opening paragraph of the description and which is characterized in that it comprises the steps of:
comparing to the maximum size of the decoder""s buffer state the total number of bits given by the addition of the bits associated to the last transmitted picture (02) of the first sequence and the first transmitted picture (N1) of the second sequence and entering the decoder""s buffer between said time tsw and the decoding time of said last transmitted picture (02);
if said number is higher than said maximum size, increasing the bitrate of said second sequence with respect to the bitrate Rnew for at least its first transmitted picture, at least up to a value Rint for which said total number is correspondingly reduced to a value at most equal to said maximum size.
It is known, in MPEG-2 standard, that video switching is facilitated by the use of special access points called xe2x80x9csplicing pointsxe2x80x9d. Switch can be performed only if same splicing points are present on both new and old video sequences. According to the present invention, in spite of the fact that the bitrate of the new sequence is already greater than the bitrate of the old one, this new bitrate is further (but temporarily) increased in such a manner that the bits of the first transmitted picture N1 of the new sequence need less time to enter the decoder""s buffer. So the first bit of said picture may enter later said buffer, and the addition of the bits of the last transmitted old picture 02 and the bits of the first transmitted new picture N1, that are at least partially in the buffer during the same period Tv, then leads to a lower value, sufficient to avoid overflow if the bitrate has been sufficiently increased. The switching operation is now possible without any overflow problem, and without using any splicing point in order to facilitate it.